<template>
    <div class="home-container">

        <div class="header">
        <div class="myheader">
          <el-button class="header-btn" @click="tologin">登陆/注册</el-button>
            <div class="mytitle">
                医+系统
            </div>
             <img src="../assets/images/hospital.jpg" alt="" class="right-img">

        </div>
        </div>
      
   <el-menu @select="handleSelect" mode="horizontal" class="myMenu" 
   text-color="#fff">
                <el-menu-item
                    v-for="(item, index) in menuList"
                    :index="item.path"
                    :key="index">
                    {{item.mate.title}}
                </el-menu-item>
            </el-menu>

        <div class="home-view-container">
            <router-view></router-view>
        </div>
    </div>
</template>

<script>

import routerList from '../router/index.js'

export default {
    name: 'homeMain',
    comName: '首页页面',
    data () {
        return {
            menuList: [],
            
        }
    },
    methods: {
        handleSelect (value) {
            this.$router.push({
                path: value
            })
        },
        tologin(){
            this.$router.push(
             { path: '/login'})
        },
    },
    mounted () {

        let routes = [...routerList.options.routes[3].children]

        this.menuList = routes.sort((prev, next) => {
            return prev.mate.sort - next.mate.sort
        })
        
    }
}
</script>

<style lang="scss" scoped>

.home-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;

.header{

    .myheader{
          display: flex;
          justify-content: space-between;
          align-items: center;

    .header-btn{
            height: 50px;
            width: 120px;
            background-color: rgb(125,173,245);
            margin-left: 5px;
            color: #ffffff;
            font-size: 15px;
            text-align: center;
            
        }

        .right-img{
            width: 150px;
            height: 90px;
        }


        .mytitle{
             line-height: 90px;
            font-size: 30px;
            color: rgb(113, 157, 223);
            font-weight: bolder;

        }
    }

        
}
 .myMenu{ 
     display: flex;
      justify-content: center;
    align-items: center;
    background-color:rgb(125,173,245);

    .el-menu-item{
 font-size: 18px;
margin-right: 50px;
    }
        .el-menu-item:hover{
           background-color: rgb(92, 129, 184);
    }
  }
    .home-view-container {
        flex: 1;
    }
}


</style>